package com.oscarmovie.dao;

import java.util.List;

import org.hibernate.Query;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.oscarmovie.model.Mpr;

public class MprDaoImpl extends HibernateDaoSupport implements MprDao {

	
	public void save(Mpr mpr) {
		getSession().saveOrUpdate(mpr);
	}

	public Mpr load(int id) {
		Mpr mpr = (Mpr)getSession().load(Mpr.class, id);
		return mpr;
	}
	
	
	public List<Mpr> loadAll() {
		Query query = getSession().createQuery("from Mpr mpr");
		query.setCacheable(true);
		List<Mpr> list = (List<Mpr>)query.list();
		return list;
	}

	
	public void delete(Mpr mpr) {
		getSession().delete(mpr);
	}
	
}
